#!/usr/bin/env python
# coding=utf-8

PACKAGE = "pf_driver"

from dynamic_reconfigure.parameter_generator_catkin import *

#----------R2000 Parameters------------------------------------------------------
gen_r2000 = ParameterGenerator()

ip_mode_enum = gen_r2000.enum([ gen_r2000.const("static", int_t, 0, "Static IP mode"),
                                gen_r2000.const("dhcp",   int_t, 1, "DHCP IP mode"),
                                gen_r2000.const("autoip", int_t, 2, "AutoIP mode")],
                                "An enum to set IP mode")
gen_r2000.add("ip_mode",              int_t,    1, "ip_mode value determines the method used by the device to determine its own IP and network conﬁguration.", 2, edit_method=ip_mode_enum)
gen_r2000.add("ip_address",           str_t,    2, "IP address", "10.0.10.9")
gen_r2000.add("subnet_mask",          str_t,    3, "IP netmask", "255.0.0.0")
gen_r2000.add("gateway",              str_t,    4, "IP gateway", "0.0.0.0")
gen_r2000.add("scan_frequency",       int_t,    5, "The parameter scan_frequency defines the set point for the rotational speed of the sensor head and therefore the number of scans recorded per second. For the R2000 valid values range from 10 Hz to 50 Hz with steps of 1 Hz.", 35, 10, 50)

scan_direction_enum = gen_r2000.enum([ gen_r2000.const("cw",  str_t, "cw", "Clock-wise"),
                                       gen_r2000.const("ccw", str_t, "ccw", "Counter clock-wise")],
                                       "An enum to set scan direction")
gen_r2000.add("scan_direction",        str_t,    6, "The parameter scan_direction defines the direction of rotation of the sensors head. User applications can choose between clockwise rotation (cw) or counter-clockwise rotation (ccw).", "ccw", edit_method=scan_direction_enum)

samples_per_scan_enum = gen_r2000.enum([ gen_r2000.const("samples_per_scan_72", int_t, 72, ""),        
                                        gen_r2000.const("samples_per_scan_90", int_t, 90, ""),
                                        gen_r2000.const("samples_per_scan_120", int_t, 120, ""),
                                        gen_r2000.const("samples_per_scan_144", int_t, 144, ""),
                                        gen_r2000.const("samples_per_scan_180", int_t, 180, ""),
                                        gen_r2000.const("samples_per_scan_240", int_t, 240, ""),
                                        gen_r2000.const("samples_per_scan_360", int_t, 360, ""),
                                        gen_r2000.const("samples_per_scan_400", int_t, 400, ""),
                                        gen_r2000.const("samples_per_scan_480", int_t, 480, ""),
                                        gen_r2000.const("samples_per_scan_600", int_t, 600, ""),
                                        gen_r2000.const("samples_per_scan_720", int_t, 720, ""),
                                        gen_r2000.const("samples_per_scan_800", int_t, 800, ""),
                                        gen_r2000.const("samples_per_scan_900", int_t, 900, ""),
                                        gen_r2000.const("samples_per_scan_1200", int_t, 1200, ""),
                                        gen_r2000.const("samples_per_scan_1440", int_t, 1440, ""),
                                        gen_r2000.const("samples_per_scan_1680", int_t, 1680, ""),
                                        gen_r2000.const("samples_per_scan_1800", int_t, 1800, ""),
                                        gen_r2000.const("samples_per_scan_2100", int_t, 2100, ""),
                                        gen_r2000.const("samples_per_scan_2400", int_t, 2400, ""),
                                        gen_r2000.const("samples_per_scan_2520", int_t, 2520, ""),
                                        gen_r2000.const("samples_per_scan_2800", int_t, 2800, ""),
                                        gen_r2000.const("samples_per_scan_3150", int_t, 3150, ""),
                                        gen_r2000.const("samples_per_scan_3600", int_t, 3600, ""),
                                        gen_r2000.const("samples_per_scan_4200", int_t, 4200, ""),
                                        gen_r2000.const("samples_per_scan_5040", int_t, 5040, ""),
                                        gen_r2000.const("samples_per_scan_5600", int_t, 5600, ""),
                                        gen_r2000.const("samples_per_scan_6300", int_t, 6300, ""),
                                        gen_r2000.const("samples_per_scan_7200", int_t, 7200, ""),
                                        gen_r2000.const("samples_per_scan_8400", int_t, 8400, ""),
                                        gen_r2000.const("samples_per_scan_10800", int_t, 10080, ""),
                                        gen_r2000.const("samples_per_scan_12600", int_t, 12600, ""),
                                        gen_r2000.const("samples_per_scan_16800", int_t, 16800, ""),
                                        gen_r2000.const("samples_per_scan_25200", int_t, 25200, "")],
                                        "An enum to set samples per scan")

gen_r2000.add("samples_per_scan", int_t, 7, "The parameter samples_per_scan defines the number of samples recorded during one revolution of the sensor head (for details please refer to section 3.1 in the R2000 Ethernet communication protocol).", 3600, 72, 25200)

hmi_display_mode_enum = gen_r2000.enum([ gen_r2000.const("hmi_display_off",  str_t, "off", ""),
                                         gen_r2000.const("static_logo", str_t, "static_logo", ""),
                                         gen_r2000.const("static_text", str_t, "static_text", ""),
                                         gen_r2000.const("bargraph_distance", str_t, "bargraph_distance", ""),
                                         gen_r2000.const("bargraph_echo", str_t, "bargraph_echo", ""),
                                         gen_r2000.const("bargraph_reflector", str_t, "bargraph_reflector", ""),
                                         gen_r2000.const("application_bitmap", str_t, "application_bitmap", ""),
                                         gen_r2000.const("application_text", str_t, "application_text", "")],
                                         "An enum to set hmi display mode")
gen_r2000.add("hmi_display_mode", str_t, 8, "The parameter hmi_display_mode controls the content of the HMI LED display during normal operation, i.e. while neither warnings nor errors are displayed and the user did not activate the HMI menu.", "static_logo", edit_method=hmi_display_mode_enum)

hmi_language_enum = gen_r2000.enum([ gen_r2000.const("english",  str_t, "english", ""),
                                     gen_r2000.const("german", str_t, "german", "")],
                                     "An enum to set hmi language")
gen_r2000.add("hmi_language", str_t, 9, "change display language", "english", edit_method=hmi_language_enum)

hmi_button_lock_enum = gen_r2000.enum([ gen_r2000.const("hmi_button_lock_on",  str_t, "on", "hmi button lock on"),
                                        gen_r2000.const("hmi_button_lock_off", str_t, "off", "hmi button lock off")],
                                        "An enum to set hmi button lock")
gen_r2000.add("hmi_button_lock", str_t, 10, "lock HMI buttons", "off", edit_method=hmi_button_lock_enum)

hmi_parameter_lock_enum = gen_r2000.enum([ gen_r2000.const("hmi_parameter_lock_on",  str_t, "on", "hmi parameter lock on"),
                                           gen_r2000.const("hmi_parameter_lock_off", str_t, "off", "hmi parameter lock off")],
                                           "An enum to set hmi parameter lock")
gen_r2000.add("hmi_parameter_lock", str_t, 11, "set HMI to read-only", "off", edit_method=hmi_parameter_lock_enum)
gen_r2000.add("hmi_static_text_1", str_t, 12, "text line 1 for mode static_text (max. 30 chars)", "Pepperl+Fuchs")	
gen_r2000.add("hmi_static_text_2", str_t, 13, "text line 2 for mode static_text (max. 30 chars)",	"R200")			

locator_indicator_enum = gen_r2000.enum([ gen_r2000.const("locator_indicator_on",  str_t, "on", "locator indicator on"),
                                          gen_r2000.const("locator_indicator_off", str_t, "off", "locator indicator off")],
                                          "An enum to set locator indicator")
gen_r2000.add("locator_indication",   str_t, 14, "LED locator indication", "off", edit_method=locator_indicator_enum)

operating_mode_enum = gen_r2000.enum([ gen_r2000.const("measure",     str_t, "measure", "measure mode"),
                                       gen_r2000.const("emitter_off", str_t, "emitter_off", "emitter_off mode")],
                                       "An enum to set operating mode")
gen_r2000.add("operating_mode",       str_t,    15, "The operating_mode, always measure after power on, can be temporarily set to emitter_off to disable the laser pulse, e.g. in order to avoid affecting other scanners.", "measure", edit_method=operating_mode_enum)
gen_r2000.add("address",              str_t,    16, "When initiating scan data output, request_handle_udp must be given an IPv4 address and port in order to know where to send scandata to.")
gen_r2000.add("port",                 int_t,    17, "See address")

packet_type_enum = gen_r2000.enum([ gen_r2000.const("packet_type_A", str_t, "A", "packet type A"),
                                    gen_r2000.const("packet_type_B", str_t, "B", "packet type B"),
                                    gen_r2000.const("packet_type_C", str_t, "C", "packettype C")],
                                    "An enum to set packet type")
gen_r2000.add("packet_type",          str_t,    18, "Packet type for scan data output", "A", edit_method=packet_type_enum)
gen_r2000.add("packet_crc",           str_t,    19, "Append extra CRC32 for scan data integrity check")
watchdog_enum = gen_r2000.enum([ gen_r2000.const("watchdog_on",     str_t, "on", "watchdog on"),
                                 gen_r2000.const("watchdog_off", str_t, "off", "watchdog off")],
                                       "An enum to set operating mode")
gen_r2000.add("watchdog",             str_t,    20, "Cease scan data output if watchdog isn't fed in time", "off", edit_method=watchdog_enum)
gen_r2000.add("watchdogtimeout",      int_t,    21, "Maximum time for client to feed watchdog", 60000)
gen_r2000.add("start_angle",          double_t, 22, "angle of first scan point for scan data output", -1800000)
gen_r2000.add("max_num_points_scan",  int_t,    23, "limit number of points in scan data output", 0)
gen_r2000.add("skip_scans",           int_t,    24, "reduce scan output rate to every (n+1)th scan", 0)
gen_r2000.add("user_tag",             str_t,    25,  "User defined name (max. 32 chars)")
gen_r2000.add("user_notes",           str_t,    26,  "User notes (max. 1000 Byte)")

exit(gen_r2000.generate(PACKAGE, "r2000_node", "PFDriverR2000"))
